/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package netshop;

import java.io.IOException;
import java.io.PrintWriter;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

/**
 *
 * @author Administrator
 */
public class area extends HttpServlet {
// <editor-fold defaultstate="collapsed" desc="HttpServlet methods. Click on the + sign on the left to edit the code.">
    /**
     * Handles the HTTP <code>GET</code> method.
     *
     * @param request servlet request
     * @param response servlet response
     * @throws ServletException if a servlet-specific error occurs
     * @throws IOException if an I/O error occurs
     */
    @Override
    protected void doGet(HttpServletRequest request, HttpServletResponse response)
            throws ServletException, IOException {
       doPost(request,response);
    }

    /**
     * Handles the HTTP <code>POST</code> method.
     *
     * @param request servlet request
     * @param response servlet response
     * @throws ServletException if a servlet-specific error occurs
     * @throws IOException if an I/O error occurs
     */
    @Override
    protected void doPost(HttpServletRequest request, HttpServletResponse response)
            throws ServletException, IOException {
       String data = "{\"count\":11,\"list\":[{\"pcaID\":\"2\",\"pcaname\":\"区\"},{\"pcaID\":\"010101\",\"pcaname\":\"我我我我\"},{\"pcaID\":\"010102\",\"pcaname\":\"迎江区\"},{\"pcaID\":\"010103\",\"pcaname\":\"大观区\"},{\"pcaID\":\"010104\",\"pcaname\":\"宜秀区\"},{\"pcaID\":\"010106\",\"pcaname\":\"怀宁县\"},{\"pcaID\":\"010107\",\"pcaname\":\"枞阳县\"},{\"pcaID\":\"010108\",\"pcaname\":\"潜山县\"},{\"pcaID\":\"010109\",\"pcaname\":\"太湖县\"},{\"pcaID\":\"010110\",\"pcaname\":\"宿松县\"},{\"pcaID\":\"010111\",\"pcaname\":\"望江县\"},{\"pcaID\":\"010112\",\"pcaname\":\"岳西县\"}]}";
		response.setContentType("text/html;charset=gb2312");
response.setHeader("Access-Control-Allow-Origin", "*");
            try (PrintWriter out = response.getWriter()) {
                out.println(data);
                out.flush();
            }
    }

    /**
     * Returns a short description of the servlet.
     *
     * @return a String containing servlet description
     */
    @Override
    public String getServletInfo() {
        return "Short description";
    }// </editor-fold>

}
